﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/User.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Site.Areas.User.ViewModels.DemandInputModels>" %>

<%@ Import Namespace="SDT.Lib.Helpers" %>
<%@ Import Namespace="SDT.Lib.Paging" %>
<%@ Import Namespace="SDT.Site.Areas.User.ViewModels" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Sửa tin cần mua/thuê
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%if (ViewData["MessageInfo"] == null)
      { %>
    <% using (Html.BeginForm("Edit", "Demand", FormMethod.Post, new {id = "adminForm"}))
       {%>
        <%= Html.ValidationSummary(true)%>
        <table class="admintable" width="100%">
            <tbody>
                   <tr>
                        <td class="key">
                            Loại nhu cầu (<font color="red">*</font>)
                        </td>
                        <td>
                            <%=Html.DropDownListFor(m=>m.Demand.DemandTypeID, new SelectList(Model.DemandTypes,"ID","Name",Model.CurrentDemandType), "-- Chọn loại nhu cầu --", new { @class="required" })%>
                        </td>
                    </tr>        
                    <tr>
                        <td class="key">
                            Phân mục (<font color="red">*</font>)
                        </td>
                        <td>
                            <%=Html.DropDownListFor(m=>m.Demand.CatID, new SelectList(Model.Categories,"ID","Name"), "-- Chuyên mục --", new { @class="required" })%>
                        </td>
                    </tr>
                    <tr>
                        <td class="key">
                            Tỉnh/Thành phố(<font color="red">*</font>)
                        </td>
                        <td>
                            <%=Html.DropDownListFor(m=>m.Demand.CityID, new SelectList(Model.ListCity,"ID","Name"), "-- Tỉnh/Thành phố --", new { @class="required" })%>
                        </td>
                    </tr>
                    <tr>
                        <td class="key">
                            Quận/Huyện (<font color="red">*</font>)
                        </td>
                        <td>
                            <%=Html.DropDownListFor(m => m.Demand.DistrictID, new SelectList(Model.ListDistrict, "ID", "Name"), "-- Quận/Huyện --", new{ @class = "required" })%>
                        </td>
                    </tr>
                    <tr>
                        <td class="key">
                            Tiêu đề (<font color="red">*</font>)
                        </td>
                        <td>
                            <%=Html.TextBoxFor(m => m.Demand.Title, new { style = "width: 500px;height:22px;", @class = "required" })%>
                        </td>
                    </tr>
                    <tr>
                        <td class="key">
                            Mô tả
                        </td>
                        <td>
                            <%=Html.TextAreaFor(m => m.Demand.Description, new { style = "width: 500px;height:150px;" })%>
                        </td>
                    </tr>
                    <tr>
                        <td class="key">
                            Số tầng
                        </td>
                        <td>
                            <%=Html.TextBoxFor(m => m.Demand.Floors, new { style = "width: 50px;height:22px; text-align: center;" })%>
                        </td>
                    </tr>
                    <tr>
                        <td class="key">
                            Số phòng
                        </td>
                        <td>
                            <%=Html.TextBoxFor(m => m.Demand.Rooms, new { style = "width: 50px;height:22px; text-align: center;" })%>
                        </td>
                    </tr>
                    <tr>
                        <td class="key">
                            Giá(<font color="red">*</font>)
                        </td>
                        <td>
                            <%=Html.TextBox("DemandCost", Model.Demand.Cost, new { style = "width: 100px;height:22px; text-align: center;", @class = "required" })%>
                            <%=Html.DropDownList("Demand.CurrencyID", new SelectList(Model.ListCurrency,"Key", "Value",Model.Demand.CurrencyID).ToList())%>
                            <%=Html.DropDownList("Demand.UnitCostID", new SelectList(Model.ListUnitCost,"Key", "Value",Model.Demand.UnitCostID).ToList())%>
                        </td>
                    </tr>
                    <tr>
                        <td class="key">
                            Diện tích(<font color="red">*</font>)
                        </td>
                        <td>
                            <%=Html.TextBox("DemandArea", Model.Demand.Area, new { style = "width: 100px;height:22px; text-align: center;", @class = "required" })%> ( m2 )
                        </td>
                    </tr>
                    <tr>
                        <td class="key">Ngày hết hạn</td>
                        <td>
                            <%=string.Format("{0:dd/MM/yyyy}",Model.Demand.ExpireDate) %> Gia hạn thêm:<%=Html.DropDownList("RangeExpireDate",new SelectList(Model.ListExpireDate,"Key", "Value").ToList(),"--Chọn số ngày--") %>
                        </td>
                    </tr>
            </tbody>
        </table>
        <table class="admintable" width="100%">
            <tbody>
            <tr>
                <td class="key">Họ tên</td>
                <td><%=Html.TextBoxFor(model => model.Demand.ContactName,new { style = "width: 500px;height:22px;"} )%></td>
            </tr>
                    <tr>
            <td class="key">
                Địa chị
            </td>
            <td>
                <%=Html.TextBoxFor(m => m.Demand.ContactAddress, new { style = "width: 500px;height:22px;" })%>
            </td>
        </tr>
        <tr>
            <td class="key">
                Mobile
            </td>
            <td>
                <%=Html.TextBoxFor(m => m.Demand.ContactMobile, new { style = "width: 250px;height:22px;" })%>
            </td>
        </tr>
         <tr>
                <td class="key">Yahoo</td>
                <td><%=Html.TextBoxFor(model => model.Demand.ContactYahoo, new { style = "width: 500px;height:22px;" })%></td>
            </tr>
             <tr>
                <td class="key">Skype</td>
                <td><%=Html.TextBoxFor(model => model.Demand.ContactSkyper, new { style = "width: 500px;height:22px;" })%></td>
            </tr>
            </tbody>
        </table>
        <div id="btnsubmit">
            <input type="submit" id="btnSave" value="Lưu thay đổi" />
        </div>
    <%}
      } %>

    <script type="text/javascript">
        $(document).ready(function() {
            $("#adminForm").validate();
            $("#tabs").tabs();
            $("#Demand_CityID").unbind("change").change(function() {
                var val = $("#Demand_CityID").val();
                if (val == "" || val == '' || val == undefined)
                    return false;
                AjaxChange("#Demand_CityID", "#Demand_DistrictID", "/AjaxData/LoadDistrictByCity/");
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
    <%= Html.Toolbar("Quay về", "/User/Demand", "back") %>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
    Sửa tin cần mua/thuê
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%>
</asp:Content>
